#include "ut.h"
#include "exp_data.h"
#include "cvxSurface.h"
#include "cvxImage.h"

using cvx::Argb8UImage;

void UT_DUXT_IS::test_parseFile(void)
{
	string file("E://code//d3d_stereo_image//dxutImageShow//dxutImageShow//data.txt");

	vector<ExpItem> data;
	ExpItem::sparseFile(file, data);
	int test = 0;
}
void UT_DUXT_IS::test_cursorSurface()
{
//	CvxCursorSurface iSF("cursor//cursor_cross_64.png");

	cv::Mat image = cv::imread(string("cursor//cursor_cross_25.png"), -1);

	

	std::vector<cv::Mat> rgbChannels(4);
	cv::split(image, rgbChannels);

	cv::imshow("0", rgbChannels[0]);
	cv::imshow("1", rgbChannels[1]);
	cv::imshow("2", rgbChannels[2]);
//	cv::imshow("3", rgbChannels[3]);

	cv::resize(image, image, cv::Size(64, 64));
	cv::imshow("4", image);

	cvx::Rgb8UImage img(&image);
	for (int y = 0; y<64; ++y)
	{
		for (int x = 0; x<64; ++x)
		{
 			img[y][x].r = 255 - img[y][x].r;
 			img[y][x].g = 255 - img[y][x].g;
 			img[y][x].b = 255 - img[y][x].b;
			if (img[y][x].r > 0)
			{
				img[y][x].r = 255;
				img[y][x].g = 255;
				img[y][x].b = 255;
			}
		}
	}

	cv::imwrite("25.png", image);


//	m_image = cv::imread(file, -1);
//	assert(!m_image.empty());
//	assert(m_image.channels() == 4);
}

void onMouse(int event, int x, int y, int flags, void* param )
{

}
void UT_DUXT_IS::test_normalMap()
{
	Mat nImage = cv::imread("measure_normal\\normal.png", 1);
	Mat rstImage = cv::imread("measure_normal\\rst.png", 1);
	
	assert(!nImage.empty());
	assert(!nImage.empty());

	cvx::Rgb8UImage n_img(&nImage);
	cvx::Rgb8UImage rst_img(&rstImage);

	cvSetMouseCallback("image",onMouse);
}
